#!/bin/sh


if [ $# -gt 2 ]; then 
	echo "Usage: $0 startdate tag"
	exit
fi

t_today=$1

tag=$2

rm -f readcal

counter=1

for files in `cat readperday`
do

	prefix=`printf "%s%03d_" $tag $counter`
	
	nodd $files $t_today $prefix >>readcal

	t_today=`cat readcal |tail -1|awk '{print $NF}'|sed -e "s/.*_//" |sed -e "s/[年月]/-/g" |sed -e "s/日.*//"`
	
	t_today=`daa +1 $t_today |sed -e "s/[年月]/-/g" |sed -e "s/日.*//"`
	
	((counter=counter+1))

done

sed -e "s/日/日.md\t/g" readcal >readcal.OK

mv readcal.OK readcal